package com.code.base.sys.service;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.code.base.sys.persistence.SysUserMapper;
import com.code.base.sys.pojo.SysUser;
import com.code.util.PrimaryKeyUtil;


@Service
public class SysUserService {


	@Resource
	private SysUserMapper sysUserMapper;

	public Long getInsertId() {
		return PrimaryKeyUtil.generatePrimaryKey();
	}

	public SysUser getDataById(Long id) {
		return sysUserMapper.getDataById(id);
	}

	public List<SysUser> getAllData() {
		return sysUserMapper.getAllData();
	}

	public int getDataCountByCondition(SysUser entity) {
		return sysUserMapper.getDataCountByCondition(entity);
	}

	public List<SysUser> getDataByCondition(SysUser entity) {
		return sysUserMapper.getDataByCondition(entity);
	}

	public int getDataCountByLikeCondition(SysUser entity) {
		return sysUserMapper.getDataCountByLikeCondition(entity);
	}

	public List<SysUser> getDataByLikeCondition(SysUser entity) {
		return sysUserMapper.getDataByLikeCondition(entity);
	}

	public List<SysUser> getDataByIds(Long[] ids) {
		return sysUserMapper.getDataByIds(ids);
	}

	public void insertData(SysUser entity) {
		insertData(entity, true);
	}

	public void insertData(SysUser entity, boolean setIdValue) {
		if (setIdValue) {
			entity.setId(getInsertId());
		}
		sysUserMapper.insertData(entity);
	}

	public void updateData(SysUser entity) {
		sysUserMapper.updateData(entity);
	}

	public void updateDataByParam(Map<String, Object> map) {
		if (map.size() == 0)
			return;

		sysUserMapper.updateDataByParam(map);
	}

	public void deleteDataByObject(SysUser entity) {
		sysUserMapper.deleteDataByObject(entity);
	}

	public void deleteDataById(Long id) {
		sysUserMapper.deleteDataById(id);
	}

	public void deleteDataByIds(Long[] ids) {
		sysUserMapper.deleteDataByIds(ids);
	}

}
